import { createStore } from 'dva';

import useAuthModel from './models/useAuthModel';

const store = createStore({
  models: [useAuthModel],
});

//持久化存储
const saveState = (state) => {
  console.log('======= state =======\n', state);

  localStorage.setItem('userInfo', JSON.stringify(state));
};

const loadState = () => {
  const state = localStorage.getItem('userInfo');
  if (state) {
    store.replaceState(JSON.parse(state));
  }
};
loadState();
export default store;
